package com.cskaoyan.service;

import com.cskaoyan.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author stone
 * @date 2022/07/06 09:42
 */
@Component("userService")
public class UserServiceImpl implements UserService{

    @Autowired
    @Qualifier("userDaoImpl")
    UserDao userDao;

    @Resource(name = "userDao2")
    UserDao userDao2;

    @Override
    public void sayHello() {
        System.out.println("hello spring");
    }

    // 形参，默认按照类型容器中引入（和@Bean对应的方法的形参一样），如果该类型的组件不止一个，使用@Qualifier指定
    /*@Autowired
    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }*/
}
